{include file='public/new_header'}
<link rel="stylesheet" type="text/css" href="__PUBLIC__/js/lib/layui/css/layui.css"/>

</head>

<body>
    <!-- 最顶部 -->
    <div class="head">
        <img src="__STATIC__/new/image/left-correct.png" alt="" class="back">
        <div class="top">
            <span>个人信息</span>
        </div>
    </div>
    <!-- 内容部分 -->
    <div class="conten">
        <a href="{:url('edit_head_img')}">
        <div class="amend">
            <div class="adm addd">
                <h4>修改头像</h4>
                <img src="__STATIC__/new/image/right-correct.png" alt="">
            </div>
            <i></i>
        </div>
        </a>
        <a href="{:url('edit_name')}">
        <div class="nam">
            <div class="nmt addd">
                <h4>修改姓名</h4>
                <div class="nvp">
                    <span>{$_user.name}</span>
                    <img src="__STATIC__/new/image/right-correct.png" alt="">
                </div>
            </div>
            <i></i>
        </div>
        </a>
        <a href="{:url('edit_pwd')}?type=1">
        <div class="amend">
            <div class="adm addd">
                <h4>修改登录密码</h4>
                <img src="__STATIC__/new/image/right-correct.png" alt="">
            </div>
            <i></i>
        </div>
        </a>
        
            <div class="amend">
                <a href="{:url('edit_pwd')}?type=2">
                <div class="adm addd">
                    <h4>修改支付密码</h4>
                    <img src="__STATIC__/new/image/right-correct.png" alt="">
                </div>
                <i></i>
            </a>
            </div>
          
        <a href="/method">
            <div class="amend">
                <div class="adm addd">
                    <h4>收款方式</h4>
                    <img src="__STATIC__/new/image/right-correct.png" alt="">
                </div>
            </div>
        </a>
        <div class="amend">
            <div class="adm addd layui-form">
                <h4>自动复购</h4>
                <input type="checkbox"  lay-skin="switch" lay-filter='is_auto'  lay-text="开启|关闭" {if $_user.is_auto=='1'}checked{/if} data-id='{$_user.id}' url="{:URL(request()->controller().'/state',['key'=>'is_auto','id'=>$_user.id])}">
            </div>
        </div>
        <!-- <li class="item-content item-input">
            <div class="item-inner">
                <div class="item-title item-label">默认地址</div>
                <div class="item-input-wrap">
                    <label class="toggle toggle-init color-green">
                        <input type="checkbox" name="is_default" value="1" {if condition="!isset($info.is_default) || $info.is_default eq 1"}checked="checked"{/if} >
                        <span class="toggle-icon"></span>
                    </label>
                </div>
            </div>
        </li> -->
    </div>
    <script>
    layui.use('form', function(){
        var form = layui.form;
        console.log(form);
        form.on('switch(is_auto)', function(data){
            console.log(data.elem); //得到checkbox原始DOM对象
            console.log(data.elem.checked); //开关是否开启，true或者false
            console.log(data.value); //开关value值，也可以通过data.elem.value得到
            console.log(data.othis); //得到美化后的DOM对象
            var obj = $(data.elem);
            $.get("state",{id:obj.attr('data-id'),key:'is_auto','val':data.elem.checked},function(){

            })
        });  
        //各种基于事件的操作，下面会有进一步介绍
      });
    </script>
</body>

</html> 